package com.gouda.core.dto.address;

import com.google.common.collect.Lists;
import lombok.Data;

import java.util.List;

/**
 * Created by 大力 on 2015/12/8.
 */
@Data
public class UserAddressDto {
    private long uid;
    private List<AddressDto> addresses;

    public UserAddressDto() {
        addresses = Lists.newArrayList();
    }

    public UserAddressDto addAddress(final long addressId, final String realName,
                                     final String phone, final String addressDetail,
                                     final boolean isdefault) {
        final AddressDto address = new AddressDto(addressId, realName, phone, addressDetail, isdefault);
        addresses.add(address);
        return this;
    }

    @Data
    private static class AddressDto {
        private long addressId;
        private String realName;
        private String phone;
        private String addressDetail;
        private boolean isdefault;

        public AddressDto(final long addressId, final String realName,
                          final String phone, final String addressDetail,
                          final boolean isdefault) {
            this.addressId = addressId;
            this.realName = realName;
            this.phone = phone;
            this.addressDetail = addressDetail;
            this.isdefault = isdefault;
        }
    }
}
